package com.fiestas.adapters;

import android.os.Parcel;
import android.os.Parcelable;

import com.fiestas.dao.Socio;

public class UserAdapter implements Parcelable{
	
	private boolean isChecked;
	private Socio socio;
	
	public UserAdapter(Socio socio, boolean isChecked){
		this.socio = socio;
		this.isChecked = isChecked;
	}
	
	public UserAdapter(Parcel in){
		socio = new Socio();
		socio.setName(in.readString());
		socio.setSurname(in.readString());
		this.isChecked = in.readInt() == 1 ? true:false;
		
	}
	
	
	public String getName() {
		return this.socio.getName();
	}




	public void setName(String name) {
		this.socio.setName(name);
	}




	public String getSurname() {
		return this.socio.getSurname();
	}




	public void setSurname(String surname) {
		this.socio.setSurname(surname);
	}




	public boolean getChecked() {
		return isChecked;
	}




	public void setChecked(boolean isChecked) {
		this.isChecked = isChecked;
	}




	public Socio getSocio() {
		return socio;
	}




	public void setSocio(Socio socio) {
		this.socio = socio;
	}




	@Override
	public int describeContents() {
		
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(getName());
		dest.writeString(getSurname());
		dest.writeInt(getChecked() ? 1 : 0);
		
	}
	
	public static final Parcelable.Creator<UserAdapter> CREATOR = new Parcelable.Creator<UserAdapter>() {
		
		@Override
		public UserAdapter[] newArray(int size) {
			// TODO Auto-generated method stub
			return new UserAdapter[size];
		}
		
		@Override
		public UserAdapter createFromParcel(Parcel source) {
			// TODO Auto-generated method stub
			return new UserAdapter(source);
		}
	};

}
